import React, { useState,useEffect } from 'react'
import Table from '@/pages/components/table'
import TableHeader from './tableSearchHeader'
import TableHeaderBar from './TableAddForm'
import renderUtil from '@/Utils/renderUtil'
import {Url} from '@/Utils/services/url'
import {post} from '@/Utils/axios'
export default function tableTest() {
  const columns = [
    {
      title:'项目编号',
      key:'activityBasicId',
      dataIndex:'activityBasicId',
      width:150
    },
    {
      title:'项目名称',
      key:'activityName',
      dataIndex:'activityName',
      width:150
    },
    {
      title:'地址',
      key:'activityOrganizers',
      dataIndex:'activityOrganizers',
      width:'250px'
    },
    {
      title:'项目描述',
      key:'activityContent',
      dataIndex:'activityContent',
      width:250
    },
    {
      title:'状态',
      key:'activityStatus',
      dataIndex:'activityStatus',
      width:200,
      filters: [
        {
          text: 'Joe',
          value: 'Joe',
        },
        {
          text: 'Jim',
          value: 'Jim',
        },
        {
          text: 'Submenu',
          value: 'Submenu',
          children: [
            {
              text: 'Green',
              value: 'Green',
            },
            {
              text: 'Black',
              value: 'Black',
            },
          ],
        },
      ],
      render:(text:Number,row:Object) =>{
        return renderUtil.stateRender(row)
      }
    },
    {
      title:'操作人',
      key:'modifier',
      width:150,
      dataIndex:'modifier'
    },
    {
      title:'操作时间',
      key:'gmtCreated',
      dataIndex:'gmtCreated',
      width:150,
      sorter: (a:any, b:any) => a.gmtCreated - b.gmtCreated,
      render:(text:Number,row:Object) =>{
        return renderUtil.dateRender(row)
      }   
    },
    {
      title:'操作',
      key:'action',
      width:200,
      dataIndex:'action',
      render:(text:string,row:object) =>{
        return (
          <div>
            <a >启用</a>
            <a >停用</a>
            <a >删除</a>
          </div>
        )
      }
    },
  ]
  const [data,setData] = useState([])
  const url = Url.activityList
  const formItem = {  
    activityName:'',
    activityStatus:[],
    isDraft:0
  }
  function refresh(){

  }
  function onChooseItem(list:any){

  }
  return (
    <div>
      <TableHeader></TableHeader>
      <TableHeaderBar></TableHeaderBar>
      <Table 
          columns={columns}  // table列表
          url={url}          // 请求地址
          formItem={formItem}// 请求参数
          needPage={true}    // 是否需要分页
          onChooseItem={onChooseItem} // 获取选中的项
          
          >
      </Table>
    </div>
  )
}
